home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / sb_init.c < prev    next >
Encoding:
Text File  |  1989-01-01  |  5.2 KB  |  113 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*           Screen Buffer Initialization for BinkleyTerm 2.10              */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*   This module is derived from code developed by Augie Hansen in his      */
  46. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  47. /*   kind enough to give us verbal permission to use his routines, and      */
  48. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  49. /*   If you decide to use this code in some package you are doing, give     */
  50. /*   some thought to going out and buying the book. He deserves that.       */
  51. /*                                                                          */
  52. /*--------------------------------------------------------------------------*/
  53.  
  54. #include <stdio.h>
  55. #include <stdlib.h>
  56. #include <string.h>
  57. #include "sbuf.h"
  58. #include "xfer.h"
  59. #include "com.h"
  60. #include "zmodem.h"
  61. #include "keybd.h"
  62. #include "sched.h"
  63. #include "externs.h"
  64. #include "prototyp.h"
  65.  
  66. #ifdef __TURBOC__
  67. #include <alloc.h>
  68. #else
  69. #include <malloc.h>
  70. #endif
  71.  
  72. BUFFER Sbuf;                                     /* control information */
  73. CELLP Scrnbuf;                                   /* screen buffer array */
  74.  
  75. int SB_ROWS;
  76. int SB_COLS;
  77.  
  78. #define WHITEBLANK (7 << 8) | ' '
  79.  
  80. int sb_init ()
  81. {
  82.    int i, j;
  83.    CELLP c;
  84.  
  85.    SB_ROWS = 23;
  86.    SB_COLS = 80;
  87.  
  88.    Scrnbuf = (CELLP) calloc (sizeof (CELL) * SB_ROWS * SB_COLS, 1);
  89.    Sbuf.bp = (CELLP) Scrnbuf;
  90.  
  91.    Sbuf.row = Sbuf.col = 0;
  92.    Sbuf.lcol = (int *) calloc (sizeof (int), SB_COLS);
  93.    Sbuf.rcol = (int *) calloc (sizeof (int), SB_COLS);
  94.  
  95.    for (i = 0; i < SB_ROWS; i++)
  96.       {
  97.       Sbuf.lcol[i] = SB_COLS;
  98.       Sbuf.rcol[i] = 0;
  99.       }
  100.  
  101.    Sbuf.flags = 0;
  102.  
  103.    c = Scrnbuf;
  104.    for (i = 0; i < SB_ROWS; i++)
  105.       for (j = 0; j < SB_COLS; j++)
  106.          {
  107.          (*c).cap = WHITEBLANK;
  108.          ++c;
  109.          }
  110.  
  111.    return (SB_OK);
  112. }
  113.